package com.ff.neuropp.domain;


import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ff.neuropp.util.DateSerializer;

import lombok.Data;

@Data
@Entity
@Table(name = "t_user")
public class User {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    //名字
    @Column(name = "name", length = 20 )
    private String name;

    //账号
    @Column(name = "account", length = 50 )
    private String account;

    //密码
    @Column(name = "password_hash", length = 200 )
    private String password;

    //手机
    @Column(name = "phone", length = 50 )
    private String phone;

    //工号
    @Column(name = "job_number", length = 50 )
    private String jobNumber;

    //邮箱
    @Column(name = "email", length = 50 )
    private String email;

    //科室
    @Column(name = "dept", length = 50 )
    private String dept;

    //性别 1=男 0=女
    @Column(name = "sex")
    private Integer sex;

    //昵称
    @Column(name = "nick_name", length = 50 )
    private String nickName;

    //角色
    @OneToOne
    @JoinColumn(name = "role_id")
    private Role role;

    //状态 status=0封号，默认=1正常
    @Column(name = "status")
    private Integer status = 1;

    //创建时间
    @Column(updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    private Date create_date;

    //更新时间
    @Column(name = "update_date")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    private Date update_date;
}
